<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>23.栅格内元素的整体控制技巧</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
  
    article {
      margin: 0 auto;
      width: 400px;
      height: 100px;
      border: solid 5px silver;
      display: grid;
      /*栅格高度充满整个容器，此时元素全部充满*/
      grid-template-columns: repeat(4, 100px);
      justify-items: center;
      align-items: center;
    }
  
  
  
    div {
      background-color: blueviolet;
      background-clip: content-box;
      box-sizing: border-box;
      color: white;
      border: solid 1px #DDD;
      font-size: 15px;
      height: 50px;
      width: 50px;
      padding: 10px;
    }
  </style>
  </head>
  
  <body>
    <article>
      <div>1</div>
      <div>2</div>
      <div>3</div>
      <div>4</div>
  
    </article>
  </body>
  
  </html>